/**
 * 
 */
package com.wedroid.r2d2.support;

import java.util.HashMap;
import java.util.Map;

import com.demo2do.core.utils.JsonUtils;

/**
 * @author lute
 *
 */
public class RequestParamBuilder {

    private Map<String, Object> params;

    /**
     * 
     */
    public RequestParamBuilder() {
        this.params = new HashMap<String, Object>();
    }

    /**
     * @param params
     */
    public RequestParamBuilder(Map<String, Object> params) {
        this.params = params;
    }

    /**
     * @param key
     * @param value
     * @return
     */
    public RequestParamBuilder addParameter(String key, Object value) {
        this.params.put(key, value);
        return this;
    }

    /**
     * Build the request parameters
     * @return
     */
    public Map<String, Object> build() {
        return this.params;
    }

    /**
     * BUild the request to JSON string
     * @return
     */
    public String buildJSONString() {
        return JsonUtils.toJsonString(params);
    }

}
